package com.shamar.blog.enums;


import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author JiWen
 * @time 2020/3/18 15:26
 */
public enum ClearChannelEnum {
    WECHAT_APP(1, "微信app支付", "allinClearStrategy"),
    WECHAT_MINI(2, "微信小程序", "allinClearStrategy"),
    allian(6, "通联", "allinClearStrategy"),


    AliPay(3, "支付宝App","allinClearStrategy"),
    WeChatH5(9, "微信H5","allinClearStrategy"),
    AllianWeChatH5(10, "通联H5","allinClearStrategy"),
    AliPayH5(11, "支付宝H5","allinClearStrategy"),

    WC(91, "微信汇总","allinClearStrategy"),
    ALI(92, "支付宝汇总","allinClearStrategy"),
    ALIN(93, "通联汇总","allinClearStrategy");

    private int code;
    private String desc;
    private String name;

    ClearChannelEnum(int code, String desc, String name) {
        this.code = code;
        this.desc = desc;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getName() {
        return name;
    }

    public static ClearChannelEnum getByCode(int code) {
        ClearChannelEnum[] values = ClearChannelEnum.values();
        for (ClearChannelEnum value : values) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }

    public static Map<String, String> toMap() {
        Map<String, String> map = new LinkedHashMap<>();
        for (ClearChannelEnum value : values()) {
            map.put(String.valueOf(value.code), value.desc);
        }
        return map;
    }
}
